package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description:  找出最高分
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_8 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter the number of students:  ");
		int nStudents=input.nextInt();
		System.out.print("Enter the name , score: ");
		String name=input.next();		//这行语句对名字中间有空格的情况无法处理，会出现错误
		double maxScore=input.nextDouble();
		
		for(int i=1;i<nStudents;i++) {
			System.out.print("Enter the next name , score: ");
			String nextName=input.next();		//这行语句对名字中间有空格的情况无法处理，会出现错误
			double nextMaxScore=input.nextDouble();
			if(nextMaxScore>maxScore) {
				name=nextName;
			}
		}
		
		System.out.printf("The student who has got the highest Score is : %s", name);
	}

}
